home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / gfx / edit / AmiCAD_2.07.lha / AmiCAD / ARexx / TypeAnalyse.AmiCAD < prev    next >
Text File  |  2000-11-12  |  7KB  |  211 lines

  1. /* Choix du type d'analyse Spice */
  2. /* Version 2.00, 4 octobre 1999 (Ajout analyse du point de fonctionnement .OP) */
  3. /* Version 2.01, 14 avril 2000 (Adaptation version 2.05) */
  4. /* Version 2.02, 12 novembre 2000 (Localisation anglais/français) */
  5. /* $VER: 2.02 (12/11/2000) */
  6.  
  7. options results     /* indispensable pour récupérer le résultat des macros */
  8.  
  9. signal on error     /* pour l'interception des erreurs */
  10. signal on syntax
  11.  
  12. 'LANGUAGE'
  13. if result="français.language" then fr=1
  14. else fr=0
  15.  
  16. if fr=1 then 'TITLE("Recherche analyse existante..."):OBJECTS'
  17. else 'TITLE("Searching for analysis..."):OBJECTS'
  18. objets=result
  19. objet_analyse=0
  20. analyse=''
  21. do i=1 to objets
  22.     'FINDOBJ('i',4,-1,-1)'; i=result
  23.     if i>0 then do
  24.     'READTEXT('i')'; t=result
  25.     if left(t,10)=".ANALYSE: " then do
  26.         analyse=substr(t,10)
  27.         objet_analyse=i
  28.         leave
  29.     end
  30.     end
  31.     else leave
  32. end
  33. if analyse~='' then do
  34.     if substr(analyse,1,3)="OP" then do
  35.     if fr=1 then 'REQUEST("L''analyse actuelle"+CHR(10)+"détermine le point"+CHR(10)+"de fonctionnement"+CHR(10)+"du montage"+CHR(10)+"Voulez-vous en changer?")'
  36.     else 'REQUEST("Actual analysis is"+CHR(10)+"«Operating point»"+CHR(10)+"Do-you want to change it ?")'
  37.     if result=1 then analyse=''
  38.     else analyse='OP'
  39.     end
  40.     else if substr(analyse,1,3)="AC" then do
  41.     if fr=1 then 'REQUEST("Le type d''analyse actuel"+CHR(10)+"est le type AC"+CHR(10)+"Voulez-vous en changer?")'
  42.     else 'REQUEST("Actual analysis is AC"+CHR(10)+"Do-you want to change it ?")'
  43.     if result=1 then analyse=''
  44.     else do
  45.         analyse=edition_analyse_AC(analyse)
  46.         if analyse='' then exit
  47.     end
  48.     end
  49.     else if substr(analyse,1,3)="DC" then do
  50.     if fr=1 then 'REQUEST("Le type d''analyse actuel"+CHR(10)+"est le type DC"+CHR(10)+"Voulez-vous en changer?")'
  51.     else 'REQUEST("Actual analysis is DC"+CHR(10)+"Do-you want to change it ?")'
  52.     if result=1 then analyse=''
  53.     else do
  54.         analyse=edition_analyse_DC(analyse)
  55.         if analyse='' then exit
  56.     end
  57.     end
  58.     else if upper(substr(analyse,1,5))="TRAN" then do
  59.     if fr=1 then 'REQUEST("Le type d''analyse actuel"+CHR(10)+"est le type TRAN"+CHR(10)+"Voulez-vous en changer?")'
  60.     else 'REQUEST("Actual analysis is TRAN"+CHR(10)+"Do-you want to change it ?")'
  61.     if result=1 then analyse=''
  62.     else do
  63.         analyse=edition_analyse_TRAN(analyse)
  64.         if analyse='' then exit
  65.     end
  66.     end
  67.     else do
  68.     if fr=1 then 'MESSAGE("Type d''analyse inconnu"+CHR(10)+"'analyse'")'
  69.     else 'MESSAGE("Unknown analysis type"+CHR(10)+"'analyse'")'
  70.     exit
  71.     end
  72.     if analyse~="" then  'SAVEALL:SETTEXT('objet_analyse',".ANALYSE: 'analyse'")'
  73. end
  74. if analyse='' then do
  75.     if fr=1 then 'SELECT("Type d''analyse à effectuer"+CHR(10)+"Point de fonctionnement"+CHR(10)+"AC"+CHR(10)+"DC"+CHR(10)+"Transient")'
  76.     else 'SELECT("Analysis to do"+CHR(10)+"Operating point"+CHR(10)+"AC"+CHR(10)+"DC"+CHR(10)+"Transient")'
  77.     select
  78.     when result=1 then do
  79.         analyse="OP"
  80.     end
  81.     when result=2 then do
  82.         analyse=edition_analyse_AC("AC DEC/OCT/LIN 100 10 1000")
  83.     end
  84.     when result=3 then do
  85.         analyse=edition_analyse_DC("DC V 1V 10V 0.01V")
  86.     end
  87.     when result=4 then do
  88.         analyse=edition_analyse_TRAN("TRAN 0.01s 1s 0s")
  89.     end
  90.     otherwise
  91.         exit
  92.     end
  93.     if analyse='' then exit
  94.     if objet_analyse>0 then 'SAVEALL:SETTEXT('objet_analyse',".ANALYSE: 'analyse'")'
  95.     else do
  96.     if fr=1 then 'WRITE(".ANALYSE: 'analyse'",0,0):TITLE("Placez ce texte sur le document")'
  97.     else 'WRITE(".ANALYSE: 'analyse'",0,0):TITLE("Place this text on the document")'
  98.     end
  99. end
  100.  
  101. exit
  102.  
  103. edition_analyse_AC:
  104.     parse arg type variation nbre_pts freq_debut freq_fin
  105.     if type="AC" then do
  106.     if fr=1 then 'SELECT("Type de variation ('variation')"+CHR(10)+"Décade (DEC)"+CHR(10)+"Octave (OCT)"+CHR(10)+"Linéaire (LIN)")'
  107.     else 'SELECT("Variation ('variation')"+CHR(10)+"Decade (DEC)"+CHR(10)+"Octave (OCT)"+CHR(10)+"Linear (LIN)")'
  108.     select
  109.         when result=1 then do
  110.         f="DEC "
  111.         if fr=1 then v="par décade"
  112.         else v="by decade"
  113.         end
  114.         when result=2 then do
  115.         f="OCT "
  116.         if fr=1 then v="par octave"
  117.         else v="by octave"
  118.         end
  119.         when result=3 then do
  120.         f="LIN "
  121.         if fr=1 then v="de test"
  122.         else v="to test"
  123.         end
  124.         otherwise do
  125.         return ''
  126.         end
  127.     end
  128.     if fr=1 then 'ASKNUM("Nombre de points 'v'?",'nbre_pts')'
  129.     else 'ASKNUM("Number of points 'v'?",'nbre_pts')'
  130.     if result='' then return ""
  131.     else f=f||result
  132.     if fr=1 then 'ASKTEXT("Quelle est la fréquence de début?","'freq_debut'")'
  133.     else 'ASKTEXT("What is the beginning frequency ?","'freq_debut'")'
  134.     if result='' then return ""
  135.     else f=f||" "||result
  136.     freq_fin=strip(freq_fin)
  137.     if fr=1 then 'ASKTEXT("Quelle est la fréquence de fin?","'freq_fin'")'
  138.     else 'ASKTEXT("What is the ending frequency ?","'freq_fin'")'
  139.     if result='' then return ""
  140.     else analyse="AC "||f||' '||result
  141.     if fr=1 then 'MESSAGE("Attention: pour ce type"+CHR(10)+"d''analyse il faut utiliser"+CHR(10)+"un générateur de signal"+CHR(10)+"de valeur AC x")'
  142.     else 'MESSAGE("Warning: for this type"+CHR(10)+"of analysis you must use"+CHR(10)+"a signal source"+CHR(10)+"which value is AC x")'
  143.     return analyse
  144.     end
  145.     return ''
  146.  
  147. edition_analyse_DC:
  148.     parse arg type source vmin vmax pas
  149.     if type='DC' then do
  150.     if fr=1 then 'UNMARK(-1):MESSAGE("Vous devez maintenant"+CHR(10)+"sélectionner une source")'
  151.     else 'UNMARK(-1):MESSAGE("You have to select"+CHR(10)+"a source")'
  152.     if fr=1 then 'PICKOBJ("Sélectionnez le générateur à faire varier.")'
  153.     else 'PICKOBJ("Select a source.")'
  154.     f=result
  155.     if f<1 then return ''
  156.     'MARK('f'):TYPE('f')'
  157.     if result=5 then 'READTEXT('f')'
  158.     else 'READTEXT(GETREF('f'))'
  159.     f=result
  160.     if fr=1 then 'V0=ASKTEXT("Quelle est la valeur de départ ?","'vmin'")'
  161.     else 'V0=ASKTEXT("Beginning value ?","'vmin'")'
  162.  
  163.     if result='' then return ''
  164.     else f=f||' '||result
  165.     if fr=1 then 'V1=ASKTEXT("Quelle est la valeur finale ?","'vmax'")'
  166.     else 'V1=ASKTEXT("Ending value ?","'vmax'")'
  167.     if result='' then return ''
  168.     else f=f||' '||result
  169.     pas=strip(pas)
  170.     if fr=1 then 'ASKTEXT("Quel est l''incrément?","'pas'")'
  171.     else 'ASKTEXT("What is the increment step ?","'pas'")'
  172.     if result='' then return ''
  173.     else analyse="DC "||f||' '||result
  174.     return analyse
  175.     end
  176.     return ''
  177.  
  178. edition_analyse_TRAN:
  179.     parse arg type pas tmax tdebut
  180.     if upper(type)='TRAN' then do
  181.     if fr=1 then 'ASKTEXT("Temps de simulation?","'tmax'")'
  182.     else 'ASKTEXT("Simulation time ?","'tmax'")'
  183.     tmax=strip(result)
  184.     if tmax='' then return ''
  185.     pas=strip(pas)
  186.     if fr=1 then 'ASKTEXT("Pas de simulation?","'pas'")'
  187.     else 'ASKTEXT("Simulation step?","'pas'")'
  188.     pas=strip(result)
  189.     if pas='' then return ''
  190.     tdebut=strip(tdebut)
  191.     if fr=1 then 'ASKTEXT("Temps de début de la simulation?","'tdebut'")'
  192.     else 'ASKTEXT("Delay time before simulation ?","'tdebut'")'
  193.     tdebut=strip(result)
  194.     if tdebut='' then return ''
  195.     analyse="tran "||pas||" "||tmax||" "||tdebut
  196.     return analyse
  197.     end
  198.     return ''
  199.  
  200. /* Traitement des erreurs, interruption du programme */
  201. syntax:
  202. erreur=RC
  203. if fr=1 then 'MESSAGE("Script TypeAnalyse.AmiCAD"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  204. else 'MESSAGE("TypeAnalyse.AmiCAD script"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  205. exit
  206.  
  207. error:
  208. if fr=1 then 'MESSAGE("Script TypeAnalyse.AmiCAD"+CHR(10)+"Erreur en ligne 'SIGL'")'
  209. else 'MESSAGE("TypeAnalyse.AmiCAD script"+CHR(10)+"Error in line 'SIGL'")'
  210. exit
  211.